import React, { Component } from 'react'

export default class Modulemy extends Component {
  constructor(){
    super()
    this.state={
      list:[
        {name:'回馈金',money:'￥0'},
        {name:'红包',money:0},
        {name:'优惠券',money:0},
        {name:'津贴',money:'￥0'},
        {name:'礼品卡',money:0},
      ],
      list1:[
        {name:'我的订单',icon:'icon-dingdan',url:'/my'},
        {name:'周七一起拼',icon:'icon-rili',url:'/my'},
        {name:'售后服务',icon:'icon-shouhoufuwu',url:'/my'},
        {name:'邀请返利',icon:'icon-yaoqingfanli',url:'/my'},
        {name:'优先购',icon:'icon-iconset0316',url:'/my'},
        {name:'积分中心',icon:'icon-jifenguizeguankong2',url:'/my'},
        {name:'会员俱乐部',icon:'icon-huiyuan',url:'/my'},
        {name:'地址管理',icon:'icon-dizhi',url:'/my/site'},
        {name:'账号安全',icon:'icon-anquan',url:'/my'},
        {name:'帮助与客服',icon:'icon-kefu',url:'/my'},
        {name:'意见反馈',icon:'icon-fankui',url:'/my'},
      ]
    }
  }
  render() {
    const {list,list1} =this.state
    let username = JSON.parse(localStorage.getItem('loginId'))  || ''
    return (
      <div className='my'>
        <div className='myHeader'>
          <div className='myPhoto'><img alt='' src='//yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png' onClick={()=>{this.props.history.push('/my/mycontent')}}  className='myPhoto'></img></div>
          <div className='myUser'>
            <h2>{username.username === '' ? '':username.username}</h2>
            <h3>普通用户</h3>
          </div>
        </div>
        <div className='myHeader2'>
          <h2 className='border-bottom'>我的资产</h2>
          <div className='myMoney'>
            {list.map((item,index) =>(
              <div key={index} className='myMoneyBox'>
                <p>{item.money}</p>
                <p>{item.name}</p>
              </div>
            ))}
          </div>
        </div>
        <div className='myList'>
          {list1.map((item,index) =>(
            <div key={index} className='myListBox' onClick={()=>{this.props.history.push(item.url)}}><span className={`iconfont myIconfont ${item.icon}`}/><span>{item.name}</span></div>
          ))}
        </div>
        <div className='myLaout'><span onClick={() =>{
          localStorage.clear('loginId')
          this.props.history.push('/login')}}>退出登录</span></div>
      </div>
    )
  }
}
